﻿using MediatR; 
using S.Organization.Domian.Model;
using S.Organization.Infrastructure;
using S.Organization.Read.API.Application.Command.ClientCommand;

namespace S.Organization.Read.API.Application.CommandHandler.ClientCommandHandler
{
    public class GetClientByIdCommandHandler : IRequestHandler<GetClientByIdCommand, Client>
    {
        private readonly IBaseRepository<Client> _repository;


        public GetClientByIdCommandHandler(IBaseRepository<Client> repository)
        {
            _repository = repository;
        }

        public Task<Client> Handle(GetClientByIdCommand request, CancellationToken cancellationToken)
        {
            return _repository.GetAsync(request.Id);
        }
    }
}
